/*
 * @Description: jishupu-admin-template
 * @Author: 技术铺<jishupu@qq.com>
 * @Date: 2022-03-03
 */
const { success } = require('./utils')

// 普通列表案例模块
module.exports = [
  // 列表
  {
    url: '/v1/example/example-table$',
    type: 'get',
    response: config => {
      const result = {
        'items': [
          {
            'id': 1,
            'title': '这是一篇演示文章',
            'cover_image': [
              {
                'id': 9,
                'name': 'Snipaste_2022-02-28_14-21-31.png',
                'description': '',
                'path': 'static/img/demo/6QdvsDuKqPX1WfdqDnKkB58bf05ANzXEZHf5KXsE.png',
                'url': 'http:\/\/localhost:9527/static/img/demo/6QdvsDuKqPX1WfdqDnKkB58bf05ANzXEZHf5KXsE.png'
              }
            ],
            'recommend_type': [],
            'status': 1,
            'created_at': '2022-02-28 15:10:09',
            'updated_at': '2022-02-28 15:10:09'
          }
        ],
        'meta': {
          'current_page': 1,
          'last_page': 1,
          'per_page': '20',
          'total': 1
        }
      }
      return success(result)
    }
  },
  // 详情
  {
    url: '/v1/example/example-table/\\d+$',
    type: 'get',
    response: config => {
      const result = {
        'id': 1,
        'category_id': 7,
        'switch': 1,
        'title': '这是一篇演示文章',
        'cover_image': [
          {
            'id': 9,
            'name': 'Snipaste_2022-02-28_14-21-31.png',
            'description': '',
            'path': 'static/img/demo/6QdvsDuKqPX1WfdqDnKkB58bf05ANzXEZHf5KXsE.png',
            'url': 'http:\/\/localhost:9527/static/img/demo/6QdvsDuKqPX1WfdqDnKkB58bf05ANzXEZHf5KXsE.png'
          }
        ],
        'keywords': [
          '技术铺',
          'vuejs',
          'element'
        ],
        'description': '',
        'content': '',
        'recommend_type': [],
        'start_time': '2022-02-08 00:00:00',
        'end_time': '2022-03-31 00:00:00',
        'type': 1,
        'tree': [
          '1',
          '3',
          '4',
          '5',
          '6',
          '7',
          '2'
        ],
        'file_ids': [
          {
            'id': 10,
            'name': 'Snipaste_2022-02-28_14-45-35.png',
            'description': '',
            'path': '/static/img/demo/6QdvsDuKqPX1WfdqDnKkB58bf05ANzXEZHf5KXsE.png',
            'url': 'http://localhost:9527/static/img/demo/6QdvsDuKqPX1WfdqDnKkB58bf05ANzXEZHf5KXsE.png'
          }
        ],
        'province_id': 1,
        'city_id': 1,
        'county_id': 11,
        'icon': '',
        'href': 'http://www.jishupu.com',
        'counts': 1,
        'image_list': [],
        'status': 1,
        'created_at': '2022-02-28 15:10:09',
        'cascader_category_ids': [
          1,
          4,
          6,
          7
        ]
      }
      return success(result)
    }
  },
  // 添加
  {
    url: '/v1/example/example-table$',
    type: 'post',
    response: config => {
      return success({}, '添加成功')
    }
  },
  // 修改
  {
    url: '/v1/example/example-table/\\d+$',
    type: 'put',
    response: config => {
      return success({}, '修改成功')
    }
  },
  // 模拟修改状态
  {
    url: '/v1/example/example-table/\\d+/status',
    type: 'patch',
    response: config => {
      return success({}, '修改成功')
    }
  },
  // 模拟排序
  {
    url: '/v1/example/example-table/sort',
    type: 'put',
    response: config => {
      return success({}, '排序成功')
    }
  },
  // 模拟删除
  {
    url: '/v1/example/example-table/\.*',
    type: 'delete',
    response: config => {
      return success({}, '删除成功')
    }
  }
]
